package com.clkj.xiuzheng.controller;

import com.clkj.xiuzheng.pojo.ProductStock;
import com.clkj.xiuzheng.pojo.common.Result;
import com.clkj.xiuzheng.pojo.common.StatusCode;
import com.clkj.xiuzheng.service.ProductStocksService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/productstock")
@Api(value = "/productstock",tags = {"库存管理"})
@CrossOrigin
public class ProductStockController {

    @Autowired
    ProductStocksService  productStocksService;


    @ApiOperation(value = "根据库存名字获取库存列表")
    @PostMapping("/listProductStock")
    public Result listProductStock(@RequestParam(required = false) String productStockName,Integer companyId){
        try {
            List<ProductStock> productStocks= productStocksService.listProductStock(productStockName,companyId);
            return new Result(true, StatusCode.OK,"查询成功",productStocks);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, StatusCode.ERROR,"查询失败");
        }
    }






}
